<div class="page-header">
    <h4>壁纸分类</h4>
</div>

<?php if($categories){ ?>
<?php $id = 'GC_' . uniqid(); ?>
<div data-non_equal_rows="true" data-block="#<?php echo $id; ?>"
     data-container=".grid_container" data-item=".item" id="<?php echo $id; ?>"
     class="grid_container_block">
    <div class="grid_container">
        <?php $numItems = count($categories);
        $i = 0;
        $width = $this->session->userdata('item_width');
        $per_row = $this->session->userdata('per_row');
        $slice = false;
        if ($per_row) {
            $total_items = count($categories);
            $slice = floor($total_items / $per_row) * $per_row;
        }
        ?>
        <?php foreach ($categories as $k => $cat) { ?>
            <div
                style="<?php echo ($width ? 'width:' . $width . 'px;' : '') . ($slice && $slice <= $k ? 'display:none;' : ''); ?>"
                class="item">
                <div class="thumbnail thumbnail-lg">
                    <div class="pr">
                        <?php $search_replace = array('{C_SLUG_FULL}' => $cat->cFullSlug, '{C_SLUG}' => $cat->category_slug); ?>
                        <?php $front_link = $this->route_links->build_link('category_page', $search_replace); ?>
                        <a href="<?php echo $front_link; ?>">
                            <img class=""
                                 src="<?php echo $this->image_workshop->crop_image(ORIGINALS_FOLDER_WF . '/' . $cat->wallpaper_image_path, 225, 150, $cat->wallpaper_crop_position, 'thumbnail'); ?>"
                                 alt="<?php echo $cat->wallpaper_name; ?>">
                        </a>
                        <h5 class="text-center"><?php echo $cat->category_name; ?></h5>

                    </div>
                </div>
            </div>
        <?php } ?>
        <div class="clearfix"></div>
    </div>
</div>
<?php } ?>